import { HostEnum, type ConfigJsonType } from "~/utils";
import { getServerCache } from "../plugins/cache";

/** 获取游戏配置文件 */
export default defineEventHandler(async (event): Promise<ConfigJsonType> => {
  const { hostName = HostEnum.localhost } = await readBody(event);
  const config = getServerCache().gameJsonDataSource[hostName];
  const { logoMeta, siteName, GAConfig, gamConfig, themeJson, logo, aboutJson, gamNo } =
    config || {};
  return {
    logoMeta,
    siteName,
    GAConfig,
    gamConfig,
    themeJson,
    logo,
    aboutJson,
    gamNo,
  };
});
